﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="WorkFlow_WFDesigner_VarEdit" Codebehind="VarEdit.aspx.cs" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>变量信息维护</title>
    <link href="../Styles/control.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../Scripts/jquery-1.4.1.js"></script>
    <script language="javascript" type="text/javascript" src="../Scripts/calendar.js"></script>
    <script language="javascript" type="text/javascript" src="../Scripts/control.js"></script>
    <script language="javascript" type="text/javascript">
        function setVar(value) {
            $.ajax({
                type: "POST",
                url: "JSON/Var.ashx",
                data: "ID=" + value,
                success: function (msg) {
                    var json = eval("(" + msg + ")");
                    document.getElementById("<%=HidVarID.ClientID %>").value = value;
                    document.getElementById("<%=HidDataType.ClientID %>").value = json.DataType;
                    setValueType(json.DataType, json.IniValue, json.Description);
                }
            });
        }
        function setValueType(dataType, iniValue, description) {
            var ddlDataType = document.getElementById("<%=ddlDataType.ClientID %>");
            for (i = 0; i < ddlDataType.options.length; i++) {
                if (ddlDataType.options[i].value == dataType) {
                    ddlDataType.options[i].selected = true;
                    break;
                }
            }
            document.getElementById("<%=txtCalendar.ClientID %>").style.display = 'none';
            document.getElementById("<%=txtChar.ClientID %>").style.display = 'none';
            document.getElementById("<%=rblBoolean.ClientID %>").style.display = 'none';
            document.getElementById("<%=numValue.ClientID %>").style.display = 'none';
            document.getElementById("<%=txtCalendarInstance.ClientID %>").style.display = 'none';
            document.getElementById("<%=txtCharInstance.ClientID %>").style.display = 'none';
            document.getElementById("<%=rblBooleanInstance.ClientID %>").style.display = 'none';
            document.getElementById("<%=numValueInstance.ClientID %>").style.display = 'none';
            if (dataType == '<%=((int)Honestysoft.Workflow.Model.WFEnumData.DataType.CharType).ToString() %>') {
                document.getElementById("<%=txtChar.ClientID %>").style.display = 'block';
                document.getElementById("<%=txtCharInstance.ClientID %>").style.display = 'block';
                document.getElementById("<%=txtChar.ClientID %>").value = iniValue;
                document.getElementById("<%=txtCharInstance.ClientID %>").value = iniValue;
                document.getElementById("<%=txtChar.ClientID %>").disabled = true;
            }
            else if (dataType == '<%=((int)Honestysoft.Workflow.Model.WFEnumData.DataType.NumType).ToString() %>') {
                document.getElementById("<%=numValue.ClientID %>").style.display = 'block';
                document.getElementById("<%=numValueInstance.ClientID %>").style.display = 'block';
                document.getElementById("<%=numValue.ClientID %>").value = iniValue;
                document.getElementById("<%=numValueInstance.ClientID %>").value = iniValue;
                document.getElementById("<%=numValue.ClientID %>").disabled = true;
            }
            else if (dataType == '<%=((int)Honestysoft.Workflow.Model.WFEnumData.DataType.DateType).ToString() %>') {
                document.getElementById("<%=txtCalendar.ClientID %>").style.display = 'block';
                document.getElementById("<%=txtCalendarInstance.ClientID %>").style.display = 'block';
                document.getElementById("<%=txtCalendar.ClientID %>").value = iniValue;
                document.getElementById("<%=txtCalendarInstance.ClientID %>").value = iniValue;                
                document.getElementById("<%=txtCalendar.ClientID %>").disabled = true;
            }
            else if (dataType == '<%=((int)Honestysoft.Workflow.Model.WFEnumData.DataType.BooleanType).ToString() %>') {
                document.getElementById("<%=rblBoolean.ClientID %>").style.display = 'block';
                document.getElementById("<%=rblBooleanInstance.ClientID %>").style.display = 'block';
                document.getElementById("<%=rblBoolean.ClientID %>").value = iniValue;
                document.getElementById("<%=rblBoolean.ClientID %>").disabled = true;
                document.getElementById("<%=rblBooleanInstance.ClientID %>").value = iniValue;
            }
            document.getElementById("<%=HidValue.ClientID %>").value = iniValue;
            document.getElementById("<%=txtDescription.ClientID %>").value = description;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" class="t1" >
        <thead>
            <th>变量信息维护</th>
        </thead>
    </table>
   <table align="center"  width="100%"  border="0" cellpadding="3" cellspacing="0" class="tEdit">
	<tr>		
		<td style="width:80px" class="title1">
            变量名称</td>
		<td>
            <asp:DropDownList ID="ddlVarTemplateID" runat="server" onchange="setVar(this.value);" Width="98%" CssClass="input2">
            </asp:DropDownList></td>
		<td style="width:80px"  class="title1">
            数据类型</td>
		<td >
            <asp:DropDownList ID="ddlDataType" runat="server" Width="98%" Enabled="False"  CssClass="input2">
            </asp:DropDownList></td>
	</tr>
	<tr>		
		<td  class="title1">
            初 始 值</td>
		<td colspan="3">
            <asp:TextBox ID="txtCalendar" runat="server" CssClass="input2"  onfocus="setday(this);" style="display:none" Width="96%"  ></asp:TextBox>
                <asp:TextBox ID="txtChar" runat="server"  CssClass="input2" MaxLength="200" Width="96%" style="display:none"></asp:TextBox>
                <asp:RadioButtonList ID="rblBoolean" runat="server" RepeatColumns="2" RepeatLayout="Flow"  style="display:none" >
                    <asp:ListItem Selected="True" Value="true" Text="true"></asp:ListItem>
                    <asp:ListItem Value="false" Text="false"></asp:ListItem>
                </asp:RadioButtonList>
                <asp:TextBox ID="numValue" runat="server"  style="display:none"   cssClass="input2" onbeforepaste="numboxPaste();" onkeypress="isDecimal();" Width="96%"></asp:TextBox>
</td>
       
	</tr>
	<tr>				
		   <td  class="title1">  说明</td>
		<td  colspan="3" ><asp:textbox id="txtDescription" MaxLength="50" Runat="server" Width="98%" Enabled="False" TextMode="MultiLine"  CssClass="input2" ></asp:textbox></td>
	</tr>
	<tr>
        <td  class="title1">
            变量实例初始值</td>
		<td colspan="3" >
            <asp:TextBox ID="txtCalendarInstance" onpropertychange="setInstanceValue(this.value);" runat="server" CssClass="input2"  onfocus="setday(this);" style="display:none" Width="96%"  ></asp:TextBox>
                <asp:TextBox ID="txtCharInstance" onpropertychange="setInstanceValue(this.value);"  runat="server"  CssClass="input2" MaxLength="200" Width="96%" style="display:none"></asp:TextBox>
                <asp:RadioButtonList ID="rblBooleanInstance" runat="server"   RepeatColumns="2" RepeatLayout="Flow"  style="display:none" >
                    <asp:ListItem Selected="True" Value="true" Text="true" onclick="setInstanceValue(this.value);"></asp:ListItem>
                    <asp:ListItem Value="false" Text="false"  onclick="setInstanceValue(this.value);"></asp:ListItem>
                </asp:RadioButtonList>
                <asp:TextBox ID="numValueInstance" runat="server" onpropertychange="setInstanceValue(this.value);"   style="display:none"   cssClass="input2" onbeforepaste="numboxPaste();" onkeypress="isDecimal();" Width="96%"></asp:TextBox>

        </td>
    </tr>
</table> 

<table width="100%"  border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td> <div align="center">
    <asp:Button ID="btnOK" runat="server" Text="确定" OnClick="btnOK_Click"   class="btn_normal" onmouseover="this.className='btn_active'" onmouseout="this.className='btn_normal'"  />
            
    <input type="submit" class="btn_normal" onmouseover="this.className='btn_active'" onmouseout="this.className='btn_normal'" name="btnCancel" onclick="window.close();"    value="取 消" />
   </div></td>
  </tr>
</table>

<input type="hidden" id="HidID" runat="server" />
<input type="hidden" id="HidProjectID" runat="server" />
<input type="hidden" id="HidJobTemplateID" runat="server" />
<input type="hidden" id="HidVarID" runat="server" />
<input type="hidden" id="HidDataType" runat="server" />
<input type="hidden" id="HidValue" runat="server" />
<script language="javascript" type="text/javascript">
    function setInstanceValue(value) {
        document.getElementById("<%=HidValue.ClientID %>").value = value;
    }
</script>
    </form>
</body>
</html>

